package com.futures.questionbank.view;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.CenterInside;
import com.bumptech.glide.request.RequestOptions;
import com.youth.banner.loader.ImageLoader;

/**
 * 图片加载类
 */
public class MyImageLoader extends ImageLoader {
    @Override
    public void displayImage(Context context, Object path, ImageView imageView) {
        RequestOptions options = new RequestOptions()
                         .centerCrop()
                       //  .placeholder(R.mipmap.ic_launcher_round) //预加载图片
                      //  .error(R.drawable.ic_launcher_foreground) //加载失败图片
                        .diskCacheStrategy(DiskCacheStrategy.NONE) //缓存
                        .transform(new GlideRoundTransform(5)); //圆角
        Glide.with(context)
                .load(path)
                .apply(RequestOptions.bitmapTransform(new CenterInside()))
                .apply(options)
                .into(imageView);
    }
}
